<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
	<link rel="stylesheet" href="/MeituanPR/lib/reset.css" />
	<script type="text/javascript">
		<!--修改HTML根元素单位为rem-->
		(function () {
			var docEL = document.documentElement;
			function setRemUnit() {
				//获取rem基准值
				var rem = docEL.clientWidth/10;

				//动态设置HTML根元素的fontsize
				docEL.style.fontSize = rem + 'px';
			}
			setRemUnit();
			//窗口大小变化时触发
			window.addEventListener('resize',setRemUnit);

			//窗口出现在当前屏幕时(有浏览器兼容性)
			window.addEventListener('pageshow',function (e) {
				if (e.persisted){
					setRemUnit();
				}
			})
		})();
	</script>
	<style type="text/css">
		<!--parents样式-->
		.a *{
			display: block;
			border: 2px solid lightgrey;
			color: lightgrey;
			padding: 5px;
			margin: 15px;
		}
	</style>
</head>
<body>
	<!--jQuery parents() 方法-->
	<div class="a">曾曾祖父节点
		<div class="b">曾祖父节点
			<div class="c">祖父节点
				<div class="d">父节点
					<span>span</span>
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript" src="/MeituanPR/lib/jquery.min.js"></script>
<script type="text/javascript">
	(function () {
		// jQuery parents() 方法
		// $('span').parents('.c').css({"border":"0.081rem solid #f00","color":"red"});
		//$('span').parents().css({"border":"0.081rem solid #f00","color":"red"});
		//$('span').parent().css({"border":"0.081rem solid #f00","color":"red"});
		//jQuery first() 方法
		//$('span').first().css({"border":"0.081rem solid #f00","color":"red"});
	})();
</script>
</body>
</html>